import request from '@/utils/request'

// 保存任务计划
export function savePlan(data) {
  return request({
    url: '/assign/save',
    method: 'post',
    data
  })
}

// 获取每日任务列表
export function getDailyTasks(params) {
  return request({
    url: '/assign/daily',
    method: 'get',
    params
  })
}

// 删除计划项
export function deletePlanItem(planItemId, userId) {
  return request({
    url: `/assign/plan-item/${planItemId}`,
    method: 'delete',
    params: { userId }
  })
}

// 获取我的计划列表
export function getMyPlans(params) {
  return request({
    url: '/assign/plans',
    method: 'get',
    params
  })
}

// 删除计划
export function deletePlan(planId) {
  return request({
    url: `/assign/plan/${planId}`,
    method: 'delete'
  })
}

// 获取计划详情
export function getPlanDetail(planId) {
  return request({
    url: `/assign/plan/${planId}`,
    method: 'get'
  })
}